
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_EBAS_BOGPAKKE_BOG_EBAS_BOG]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[EBAS_BOGPAKKE_BOG] DROP CONSTRAINT FK_EBAS_BOGPAKKE_BOG_EBAS_BOG
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EBAS_BOG]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[EBAS_BOG]
GO

CREATE TABLE [dbo].[EBAS_BOG] (
	[GUID] [uniqueidentifier] ROWGUIDCOL NOT NULL ,
	[TITEL] [varchar] (255) COLLATE Danish_Norwegian_CI_AS NOT NULL ,
	[FORFATTER] [varchar] (255) COLLATE Danish_Norwegian_CI_AS NOT NULL ,
	[FORLAG] [varchar] (255) COLLATE Danish_Norwegian_CI_AS NULL ,
	[ISBN] [varchar] (255) COLLATE Danish_Norwegian_CI_AS NULL 
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[EBAS_BOG] WITH NOCHECK ADD 
	CONSTRAINT [PK_EBAS_BOG] PRIMARY KEY  CLUSTERED 
	(
		[GUID]
	)  ON [PRIMARY] 
GO

CREATE  UNIQUE  INDEX [IDX_EBAS_BOX_ISBN] ON [dbo].[EBAS_BOG]([ISBN]) ON [PRIMARY]
GO
